package com.zq.jichu;

import java.util.Objects;

/**
 * 一个学生类
 */
public class Student {
    /**
     * 成员变量
     */
    private String name;//姓名
    private Integer age;//年龄

    /**
     * 构造方法
     * @param name
     * @param age
     */
    public Student(String name, Integer age) {
        this.name=name;
        this.age=age;
    }
    public Student(){
    }

    /**
     * 成员方法
     * @return
     */
    public String getName() {
        return name;
    }

    public void setName(String name) {
        this.name = name;
    }

    public Integer getAge() {
        return age;
    }

    public void setAge(Integer age) {
        this.age = age;
    }

    @Override
    public boolean equals(Object o) {
        if (this == o) return true;
        if (o == null || getClass() != o.getClass()) return false;
        Student student = (Student) o;
        return Objects.equals(name, student.name) &&
                Objects.equals(age, student.age);
    }

    @Override
    public int hashCode() {
        return Objects.hash(name, age);
    }

    @Override
    public String toString() {
        return "Student{" +
                "name='" + name + '\'' +
                ", age=" + age +
                '}';
    }
}
